package com.ruoyi.web.controller.kiku;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kiku.domain.JsslArtistsWorks;
import com.ruoyi.kiku.service.IJsslArtistsWorksService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 橘事顺利艺术家代表作Controller
 *
 * @author TT
 * @date 2025-09-03
 */
@RestController
@RequestMapping("/kiku/artistsWorks")
public class JsslArtistsWorksController extends BaseController
{
    @Autowired
    private IJsslArtistsWorksService jsslArtistsWorksService;

    /**
     * 查询橘事顺利艺术家代表作列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:list')")
    @GetMapping("/list")
    public TableDataInfo list(JsslArtistsWorks jsslArtistsWorks)
    {
        startPage();
        List<JsslArtistsWorks> list = jsslArtistsWorksService.selectJsslArtistsWorksList(jsslArtistsWorks);
        return getDataTable(list);
    }
    /**
     * 查询橘事顺利艺术家代表作列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:list')")
    @GetMapping("/getArtistsMasterpiece/{artistsId}")
    public AjaxResult getArtistsMasterpiece(@PathVariable("artistsId") Long artistsId)
    {
        List<JsslArtistsWorks> list = jsslArtistsWorksService.getArtistsMasterpiece(artistsId);
        return success(list);
    }

    /**
     * 导出橘事顺利艺术家代表作列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:export')")
    @Log(title = "橘事顺利艺术家代表作", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JsslArtistsWorks jsslArtistsWorks)
    {
        List<JsslArtistsWorks> list = jsslArtistsWorksService.selectJsslArtistsWorksList(jsslArtistsWorks);
        ExcelUtil<JsslArtistsWorks> util = new ExcelUtil<JsslArtistsWorks>(JsslArtistsWorks.class);
        util.exportExcel(response, list, "橘事顺利艺术家代表作数据");
    }

    /**
     * 获取橘事顺利艺术家代表作详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(jsslArtistsWorksService.selectJsslArtistsWorksById(id));
    }

    /**
     * 新增橘事顺利艺术家代表作
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:add')")
    @Log(title = "橘事顺利艺术家代表作", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JsslArtistsWorks jsslArtistsWorks)
    {
        return toAjax(jsslArtistsWorksService.insertJsslArtistsWorks(jsslArtistsWorks));
    }

    /**
     * 修改橘事顺利艺术家代表作
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:edit')")
    @Log(title = "橘事顺利艺术家代表作", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JsslArtistsWorks jsslArtistsWorks)
    {
        return toAjax(jsslArtistsWorksService.updateJsslArtistsWorks(jsslArtistsWorks));
    }

    /**
     * 删除橘事顺利艺术家代表作
     */
    @PreAuthorize("@ss.hasPermi('kiku:artistsWorks:remove')")
    @Log(title = "橘事顺利艺术家代表作", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jsslArtistsWorksService.deleteJsslArtistsWorksByIds(ids));
    }
}
